package day_2022_9_to_12.Day;

import java.util.List;

/**
 * @author haomin
 * @date 2022/10/29 21:32
 **/
public class Day56_1_Num1773_CountMatches {
    class Solution {
        public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
            int ans = 0;
            int ruleIndex = "type".equals(ruleKey) ? 0 : ("color".equals(ruleKey) ? 1 : 2);
            for (List<String> item : items) {
                if (item.get(ruleIndex).equals(ruleValue)) {
                    ans++;
                }
            }
            return ans;
        }
    }
}